package com.googlecode.imanager.client.action;

import com.googlecode.imanager.client.Control;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class ScrollAction extends Action {

    private static final long serialVersionUID = 1L;

    private Control target;
    private int offsetX;
    private int offsetY;    
    
    @Override
    protected void doExecute(Control sender) {
        if (target == null){
            sender.getRootParent().scrollToRectVisible(offsetX, offsetY, 0, 0);
        } else {
            target.scrollToRectVisible(offsetX, offsetY, target.getWidth(), target.getHeight());
        }
    }

}
